home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Games of Daze
/
Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso
/
x2ftp
/
msdos
/
hardware
/
kbdhand9
/
key.doc
< prev
next >
Wrap
Text File
|
1994-06-15
|
3KB
|
56 lines
INT9 (IRQ1) keyboard handler #9 by Patch (hamell@cs.pdx.edu)
───────────────────────────────────────────────────────────────────────────────
June 15th, 1994
Added a variable called KEYLAST so you could do input and build a string with
the values in this variable. toASCII is a translate table that it gets shifted
and unshifted characters from and stores the result in KEYLAST. The #define's
that start with b are for BIOS equivalents (most of them are). To get input
in the normal manner of getch(), call GetKey. The first key available from the
keyboard buffer is stored in KEYLAST (0 means no key available).
You can change the toASCII table to match the hardware scan codes to ASCII
codes. As it is now only alphanumeric, Enter, and ESC are translated. Keys
such as F1-F12, Insert, etc. are translated to return 0.
Description of variables/functions/files
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
keys[] - Array of 256 bytes. Each position corresponds to a key on the
keyboard. A value of 1 means the key is being pressed, 0 means
released. If you wanted to check for the LEFT SHIFT key being
pressed, you'd type
if (keys[kLEFTSHIFT] == 1) ...
keynumpress - Tells you the number of keys being pressed at any given time
If you want to do something while waiting for a keypress, you
could do
while (keynumpress == 0) ;
or
do GetKey(); while (keylast == 0);
instead of
while (!kbhit());
keylast - shifted value of last key hit
Set_New_Int9() - Call this function when you want to install the INT 9 handler
Set_Old_Int9() - Call this function when you want to uninstall the INT 9 handler
ClearKeys - clears the keyboard buffer
GetKey - returns the first key from the keyboard buffer in the variable
KEYLAST (0 means no key available)
KEY.DOC - this doc file
KEY.ASM - ASM source for the INT9 handler (32-bit)
KEY16.ASM - ............................... (16-bit)
KEY.H - C #include header file (32-bit)
KEY16.H - ...................... (16-bit)
KEY.OBJ - compiled KEY.ASM
KEY16.OBJ - compiled KEY16.ASM
KEYTEST.C - C source for a program testing the INT9 handler
KEYTEST.EXE - executable (DOS/4GW required to run it)
If you and use it (whether it be as-is or slightly modified), please credit me.
Please email me any changes you make so I can include them in future releases.
To get more similar source and/or grafx/sound source, call my board:
Dead Man's Hand
(503) 288-9264
USR 28.8k DS
Grafx/sound programming and VGA demos